﻿@using System.Linq
@using Microsoft.AspNetCore.Http.Extensions
@using Coso.Abp.Theme.AdminLTE.Themes.AdminLTE.Components.Toolbar.LanguageSwitch
@model LanguageSwitchViewComponentModel

<li class="nav-item dropdown">
    <a class="nav-link" data-toggle="dropdown" href="#">
        <i class="flag-icon flag-icon-@Model.CurrentLanguage.FlagIcon flag-icon-squared"></i>
        @Model.CurrentLanguage.DisplayName
    </a>
    <div class="dropdown-menu dropdown-menu-right p-0">
        @foreach (var language in Model.OtherLanguages)
        {
            <a href="~/Abp/Languages/Switch?culture=@(language.CultureName)&uiCulture=@(language.UiCultureName)&returnUrl=@(System.Net.WebUtility.UrlEncode(Context.Request.GetEncodedPathAndQuery()))" class="dropdown-item">
                <i class="flag-icon flag-icon-@language.FlagIcon mr-2 flag-icon-squared"></i>  @language.DisplayName
            </a>
        }

    </div>
</li>

@*<div class="dropdown dropdown-menu-right">
        <a class="nav-link" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            <span class="flag-icon flag-icon-@Model.CurrentLanguage.FlagIcon flag-icon-squared"></span> @Model.CurrentLanguage.DisplayName
        </a>
        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuLink">
            @foreach (var language in Model.OtherLanguages)
            {
                <a class="dropdown-item" href="/Abp/Languages/Switch?culture=@(language.CultureName)&uiCulture=@(language.UiCultureName)">
                    <span class="flag-icon flag-icon-@language.FlagIcon flag-icon-squared"></span> @language.DisplayName
                </a>
            }
        </div>
    </div>*@